﻿using JetBrains.Annotations;
using MugenMvvmToolkit.Interfaces.ViewModels;
using MugenMvvmToolkit.Interfaces.Views;

namespace MugenMvvmToolkit.Interfaces
{
    /// <summary>
    ///     Represents the provider which creates a view for a view model
    /// </summary>
    public interface IViewManager
    {
        /// <summary>
        ///     Gets an instance of <see cref="IView" /> for the specified view model.
        /// </summary>
        /// <param name="viewModel">The view model which is now initialized.</param>
        /// <param name="viewBindingName">The view binding name, if any.</param>
        /// <returns>
        ///     An instance of <see cref="IView" />.
        /// </returns>
        [Pure]
        IView GetView([NotNull]IViewModel viewModel, string viewBindingName = null);

        /// <summary>
        ///     Configures the specified view for the specified view-model.
        /// </summary>
        /// <param name="initializationContext">
        ///     The specified <see cref="IInitializationContext" />.
        /// </param>
        bool InitializeView([NotNull]IInitializationContext initializationContext);

        /// <summary>
        ///     Configures the specified view for the specified view-model.
        /// </summary>
        /// <param name="viewModel">The specified view model.</param>
        /// <param name="view">The specified view.</param>
        void InitializeView([NotNull]IViewModel viewModel, [NotNull] IView view);

        /// <summary>
        ///     Clears view in the specified view-model
        /// </summary>
        /// <param name="viewModel">The specified view model.</param>
        void CleanupView([NotNull]IViewModel viewModel);

        /// <summary>
        ///     Clears view in the specified view-model
        /// </summary>
        /// <param name="viewModel">The specified view model.</param>
        /// <param name="view">The specified view.</param>
        void CleanupView([NotNull]IViewModel viewModel, [NotNull] IView view);
    }
}